package sk.octopuss.archery.converter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

import sk.octopuss.archery.domain.Category;
import sk.octopuss.archery.service.CategoryService;

@Component
public class StringToCategoryConverter implements Converter<String,Category>{
	
	@Autowired
	CategoryService categoryService;
	
	@Override
	public Category convert(final String id) {
		return categoryService.find(Long.parseLong(id));
	}
	
}
